new Vue({
  el: 'header',
  components: {},
  data() {
    return {
      project: [],
      product: [],
    };
  },
  mounted() {
    window.addEventListener('scroll', this.windowScroll);
    this.getproject();
    this.getproduct();
  },
  methods: {
    getproject() {
      var that = this;
      axios.get('http://dl.sword.ink:2334/project/').then((res) => {
        that.project = res.data.data;
      });
    },
    getproduct() {
      var that = this;
      axios.get('http://dl.sword.ink:2334/product').then((res) => {
        that.product = res.data.data;
      });
    },
    toproduct(id, index) {
      //产品服务
      //   var a = document.getElementById(index);
      var x = 'a[' + 'id =' + index + ']';
      var a = $(x);
      a[0].setAttribute('href', './service.html?id=' + id);
    },
    toproject(id, index) {
      //解决方案
      //   var a = document.getElementById(index);
      var x = 'a[' + 'id =' + index + ']';
      var a = $(x);
      //   console.log(a[0]);
      a[1].setAttribute('href', './product.html?id=' + id);
    },
  },
});
